package cn.huaqingcheng.tianshu.infrastructure.sys;

import cn.huaqingcheng.tianshu.common.core.model.CommonConvert;
import cn.huaqingcheng.tianshu.core.sys.model.SysFile;
import cn.huaqingcheng.tianshu.core.sys.model.SysFileScheme;
import cn.huaqingcheng.tianshu.infrastructure.sys.entity.SysFileEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * SystemConvert
 */
@Mapper(uses = CommonConvert.class)
public interface SystemConvert {

    SystemConvert INSTANCE = Mappers.getMapper(SystemConvert.class);

    SysFile toModel(SysFileEntity entity);

    SysFileEntity toEntity(SysFile model);


    default String toValue(SysFileScheme scheme) {
        return scheme == null ? null : scheme.getValue();
    }

    default SysFileScheme toScheme(String value) {
        return value == null ? null : SysFileScheme.of(value);
    }

}
